package model.posterminal;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

import model.BaseObject;

@Root(name="posterminalproducer")
public class PosterminalProducer extends BaseObject implements Serializable{

	@Override
	protected void setStoredProcedureName() {
		
		this.selectStoreProcedureName = "selectPosterminalProducer";
		this.insertStoreProcedureName = "insertPosterminalProducer";
		this.updateStoreProcedureName = "updatePosterminalProducer";
		this.deleteStoreProcedureName = "deletePosterminalProducer";
		
	}
	
	@Element(name="producername", required=false)
	String producerName; //producer name

	public String getProducerName() {
		return producerName;
	}

	public void setProducerName(String name) {
		this.producerName = name;
	}
	
	/**
	 * Get all posterminal producer list list
	 * @return
	 * @throws Exception
	 */
	public List<PosterminalProducer> getAllProducerList() throws Exception{
		List<PosterminalProducer> result = new ArrayList<PosterminalProducer>();
		
		result = (ArrayList<PosterminalProducer>) this.selecttObjectList(null);
		
		return result;
	}
	
    // This must return true for another class object with same id.
    public boolean equals(Object other) {
        return other instanceof PosterminalProducer && (id != null) ? id.equals(((PosterminalProducer) other).id) : (other == this);
    }

    // This must return the same hashcode for every class object with the same key.
    public int hashCode() {
        return id != null ? this.getClass().hashCode() + id.hashCode() : super.hashCode();
    }
	
	
}
